﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Remoting;

namespace System
{
	/// <summary>
	/// MarshalByRefObject that has infinite lifetime.
	/// </summary>
	/// <remarks>
	/// Classes implementing listeners or session or game controllers should derive from this class.
	/// When their objects should be no longer accessible remotely (and garbage collected) their <see cref="Disconnect"/> method should be called.
	/// </remarks>
	public class ImmortalMarshalByRefObject : MarshalByRefObject
	{
		public override object InitializeLifetimeService()
		{
			return null;
		}

		/// <summary>
		/// Disconnects the object from the Remoting Services.
		/// </summary>
		public virtual void Disconnect()
		{
			RemotingServices.Disconnect(this);
		}
	}
}
